home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-20 / rs0422.zip / ROSEZSW / PASSWORD.C < prev    next >
C/C++ Source or Header  |  1990-01-28  |  357b  |  18 lines

  1. password(vec, ans)
  2. unsigned char *v, *a;
  3. {
  4.     extern unsigned char passwd[81];
  5.     static unsigned char *vec, *ans;
  6.     static int i, j, l;
  7.     int strlen(), rnd();
  8.  
  9.     vec = v;
  10.     ans = a;
  11.     l = strlen(passwd);
  12.     for (i=0;i<5;) /* Pick 5 UNIQUE items */ {
  13.         vec[i] = rnd(l);
  14.         ans[i] = passwd[vec[i]];
  15.         for (j=0;j<i;j++) if (vec[j] == vec[i-1]) i--;
  16.     }
  17. }
  18.